package com.ygqh.baby.service;

import com.ygqh.baby.ao.QueryInfo;
import com.ygqh.baby.ao.ResultSet;
import com.ygqh.baby.po.BiOrderDay;
import com.ygqh.baby.po.YgOrder;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

public interface BiOrderDayService {

    List<BiOrderDay> find();

    int findCount();

    BiOrderDay findById(Long id);

    int save(BiOrderDay biOrderDay);

    int update(BiOrderDay biOrderDay);

    int saveOrUpdate(BiOrderDay biOrderDay);

    ResultSet<BiOrderDay> search(QueryInfo queryInfo, Date startDate, Date endDate, String shopNo, String shopName, String warehouseNo);

    List<YgOrder> findOrderByDay(Date startDate, Date endDate, String[] sourceCodes);

    int addBiOrderDayBatch(List<BiOrderDay> orderDayList);

    /**
     * 统计每日订单毛利
     *
     * @param startDate
     * @param endDate
     * @return
     */
    BiOrderDay executeOrderDateGrossProfit(Date startDate, Date endDate);

    int updateByDate(BiOrderDay profit);

    List<BiOrderDay> executeOrderStatistics(Date startDate, Date endDate);

    List<BiOrderDay> statisticsOrderBySupplier(Date startDate, Date endDate);

    /**
     * 按id 增量去查
     *
     * @param start 开始id
     * @param end   开始id
     * @return List<BiOrderDay>
     */
    List<BiOrderDay> executeOrderStatisticsNew(Date start, Date end, String... shopNo);

    List<BiOrderDay> executeOrderDateGrossProfitNew(Date start, Date end, String... shopNo);

    /**
     * 实时数据 只查当天下单 ，当天支付的
     *
     * @param startDate
     * @param endDate
     * @return
     */
    BiOrderDay statisticsOrderByTime(Date startDate, Date endDate);

    BiOrderDay findByShop(String shopNo, Date date, String warehouseNo);

    BiOrderDay findByShop(String shopNo, Date date);

    int additionBatch(List<BiOrderDay> list);


    List<BiOrderDay> findList(QueryInfo queryInfo, Date startDate, Date endDate, String... excludeShopNo);

    BigDecimal getTotalOrderPrice(Date startDate, Date endDate, String... excludeShopNo);

    BigDecimal getTotalPayPriceByShop(Date startDate, Date endDate, String shopNo, String shopName, String warehouseNo);

    List<YgOrder> findOrderListAfterId(Long startId);

    Long findOrderMaxId();

    List<BiOrderDay> executeOrderStatisticsByDetail(Date start, Date end, String... shopNo);

    /**
     * 基于shopNo，warehouseNo，orderDate
     *
     * @param oldList BiOrderDay数据
     * @return int
     */
    int updateBatch(List<BiOrderDay> oldList);
}
